<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>充值流水</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript" src="${ctxStatic}/common/base-loading.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			setTimeout(GetDate, 1000);
			var container = $('div.container');
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function GetDate(){
			$("#contentTable tbody").find("tr").each(function () {
			 var name = "";
	         var numbers = $(this).find("td:eq(1)");//卡号
	         var iccid = $(this).find("td:eq(0)").html();//iccid
	         console.log(iccid)
	         //查询卡状态
	          $.ajax({
	            type: "get",
	            async: true,
	            url: "${ctx}/orders/rechargeOrder/getNumberByIccid?iccid=" + iccid,
	            contentType: "application/x-www-form-urlencoded; charset=utf-8",
	            success: function (data, textStatus) {
	            	numbers.html(data);
	            		}
	        		}); 

	    		})
			}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/orders/rechargeOrder/list">充值流水列表</a></li>
		<shiro:hasPermission name="orders:rechargeOrder:save"><li><a href="${ctx}/orders/rechargeOrder/openSave">充值流水添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="rechargeOrder" action="${ctx}/orders/rechargeOrder/list" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>ICCID：</label>
				<form:input path="iccid" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			<li style="margin-left:20px;"><label>套 餐 类 型：</label>
				<form:select path="pkgType" class="input-medium" style="width:177px;">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('pkg')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li style="margin-left:20px;"><label>支付状态：</label>
				<form:select path="payState" class="input-medium" style="width:177px;">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('payState')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li style="margin-left:20px;"><label>充值状态：</label>
				<form:select path="rechargeState" class="input-medium" style="width:177px;">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('rechargeState')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>订单号：</label>
				<form:input path="orderNo" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			<li><label>内部订单号：</label>
				<form:input path="rechargeOrderNo" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			<li class="btns">
				<a id="btnSubmit" class="btn btn-primary" onclick="return page();"><i class="icon-search"></i>&nbsp;查询</a>
			</li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>iccid</th>
				<th>卡号</th>
				<th>订单号</th>
				<th>内部订单号</th>
				<th>所属代理商</th>
				<th>所属套餐类型</th>
				<th>套餐</th>
				<th>充值金额</th>
				<th>支付状态 </th>
				<th>充值状态</th>
				<th>创建时间</th>
				<th>支付时间</th>
				<th>充值时间</th>
			</tr>
		</thead>
		<tbody>
		<c:choose>
			<c:when test="${not empty page.list}">
				<c:forEach items="${page.list}" var="rechargeOrder">
					<tr>
						<td>
							${rechargeOrder.iccid}
						</td>
						<td>
							<span >加载中...</span>
						</td>
						<td>
							${rechargeOrder.orderNo}
						</td>
						<td>
							${rechargeOrder.rechargeOrderNo}
						</td>
						<td>
							${rechargeOrder.officeName}
						</td>
						<td>
							${fns:getDictLabel(rechargeOrder.pkgType, 'pkg', '未知')}
						</td>
						<td>
							${rechargeOrder.pkg}
						</td>
						<td>
							${rechargeOrder.money}
						</td>
						<td>
							${fns:getDictLabel(rechargeOrder.payState, 'payState', '未知')}
						</td>
						<td>
							${fns:getDictLabel(rechargeOrder.rechargeState, 'rechargeState', '未知')}
						</td>
						<td>
							<fmt:formatDate value="${rechargeOrder.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
						<td>
							<fmt:formatDate value="${rechargeOrder.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
						<td>
							<fmt:formatDate value="${rechargeOrder.rechargeTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
					</tr>
				</c:forEach>
			</c:when>
			<c:otherwise>
				<tr>
					<td colspan="12" style="text-align: center;font-size:17px; font-family:SimHei">未查询到数据...</td>
				</tr>
			</c:otherwise>
			</c:choose>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>